package com.example.controller;

import com.example.entity.User;
import org.springframework.web.bind.annotation.*;

@RestController
public class AController {

    @GetMapping("/noParameter")
    public String noParameter() {
        return "无参方法调用成功！";
    }

    @GetMapping("/singleParameter/{id}")
    public String singleParameter(@PathVariable("id") Integer id) {
        return "id=" + id;
    }

    @GetMapping("/multipleParameter")
    public String multipleParameter(@RequestParam("id") Integer id, @RequestParam("age") Integer age) {
        return "id=" + id + "，age=" + age;
    }

    @PostMapping("/complexObject")
    public User complexObject(@RequestBody User user) {
        return user;
    }
}
